package com.digitalchina.lxnsy.sy.main;

import android.webkit.JavascriptInterface;

import com.digitalchina.lxnsy.base.BaseHtmlFragment;
import com.digitalchina.lxnsy.sy.all.BzActivity;
import com.digitalchina.lxnsy.sy.all.CommonArchivesActivity;
import com.digitalchina.lxnsy.sy.all.InsuranceRecordsActivity;
import com.digitalchina.lxnsy.sy.all.MilkManagementActivity;
import com.digitalchina.lxnsy.sy.all.SdManagementDetailActivity;
import com.digitalchina.lxnsy.sy.channai.MilkRecordManagementActivity;
import com.digitalchina.lxnsy.sy.jgc.RawMilkConnectActivity;
import com.digitalchina.lxnsy.sy.jgc.RawMilkConnectDetailActivity;
import com.digitalchina.lxnsy.sy.jgc.SalesTraceabilityCodeQueryActivity;
import com.digitalchina.lxnsy.sy.xiaodujilu.DisinfectionRecordActivity;
import com.digitalchina.lxnsy.xml.RongCloudXML;
import com.digitalchina.lxnsy.xml.UserXML;
import com.digitalchina.lxnsy.zbsy.EarManagerListActivity;


public class   Main2Fragment extends BaseHtmlFragment {
    @Override
    protected void loadHtml() {
        webView.addJavascriptObject(new JsApi(), null);

        if("BREED_ENTERPRISE".equals(RongCloudXML.getSubjectenterprisetype(getActivity(),"subjectEnterpriseType"))||"FARMERS".equals(RongCloudXML.getSubjectenterprisetype(getActivity(),"subjectEnterpriseType"))){
            loadUrl("sdManagement");
        }else {
           loadUrl("standardizedMachining");
        }
        hideActionBar();

    }







    @Override
    public void rightOnClick() {


    }


    public class JsApi {



        @JavascriptInterface
        public void addBiaozhun(Object msg) {//标准绑定
            go(BzActivity.class);

        }



        @JavascriptInterface
        public void earManager(Object msg) {//耳标管理
            go(EarManagerListActivity.class);

        }




        @JavascriptInterface
        public void sdManagementDetail(Object msg) {//标准化养殖详情
            go(SdManagementDetailActivity.class);

        }

        @JavascriptInterface
        public void archives(Object msg) {//羊只档案
            go(CommonArchivesActivity.class);

        }


        @JavascriptInterface
        public void ebManager(Object msg) {//耳标管理
         showToast("正在维护中");
        }

        @JavascriptInterface
        public void milkManagement(Object msg) {//羊奶销售
            go(MilkManagementActivity.class);

        }

        @JavascriptInterface
        public void milkRecord(Object msg) {//产奶记录
            go(MilkRecordManagementActivity.class);

        }


        @JavascriptInterface
        public void insuranceRecords(Object msg) {//保险记录
            go(InsuranceRecordsActivity.class);

        }


        @JavascriptInterface
        public void disinfectionRecord(Object msg) {//消毒记录
            go(DisinfectionRecordActivity.class);

        }


        /***
         *加工厂的事件
         */



        @JavascriptInterface
        public void salesTraceabilityCodeQuery(Object msg) {//生鲜乳销售溯源码查询
            go(SalesTraceabilityCodeQueryActivity.class);

        }

        @JavascriptInterface
        public void rawMilkConnect(Object msg) {//生鲜乳交接
            go(RawMilkConnectActivity.class);

        }


        @JavascriptInterface
        public void rawMilkConnectDetail(Object msg) {//生鲜乳交接详请
            go(RawMilkConnectDetailActivity.class);

        }


    }
}
